import React from 'react';
/** 
 * react-redux 有一些方法将redux中的数据渲染到页面上 
 * react-redux是用来实现组件和redux之间的通信
*/
import { useSelector, useDispatch } from 'react-redux';
import { selectCount, increase } from '../../store/count';
const Index = () => {
    const count = useSelector(selectCount);
    // const count = useSelector(state => state.counter.count);
    const dispatch = useDispatch();
    return (
        <div>
            {/* 此处increase()一定要加上括号 */}
            <button onClick={() => { dispatch(increase()) }}>{count}</button>
        </div>
    );
}

export default Index;